﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded

#pragma once

#include "GcmpCommonDraw.h"

namespace gcmp
{
    class IUiView;
    class Vector3d;
    class IControlDefinition;
    class IActionInputEventArgs;
    enum class CursorType;
    class ISnap;
    class IGraphicsElementShape;
    class IPropertyPanelEventArgs;

    /// \brief 绘制矩形的操作状态
    enum class DrawRectStatus : int32_t
    {
        DRS_NOT_START = 0,           ///< 初始化中
        DRS_GETTING_FIRST_POINT = 1, ///< 获取第一点
        DRS_GETTING_CORNER_POINT = 2,///< 获取对角点
    };

    /// \brief 绘制矩形的Behavior，方便定制绘制Action的行为。
    class GCMP_COMMON_DRAW_EXPORT IActionDrawRectBehavior
    {
    public:
        /// \brief 析构函数
        virtual ~IActionDrawRectBehavior() {}

        /// \brief 输入对话框特性相关方法
    public:
        /// \brief 定义Action输入对话框UI
        /// \param title [out] 对话框标题
        /// \param inputItems [out] 对话框配置项UI
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefineInputDialog(std::wstring& title, std::vector<OwnerPtr<IControlDefinition>>& inputItems) = 0;

        /// \brief 对话框UI事件处理
        /// \param pArgs 输入事件参数
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnActionInputEvent(gcmp::IActionInputEventArgs* pArgs) = 0;


        /// \brief 属性面板特性定制方法
    public:
        /// \brief 属性面板UI事件处理
        /// \param pArgs 输入事件参数
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnPropertyPanelEvent(gcmp::IPropertyPanelEventArgs* pArgs) = 0;


        /// \brief 通用操作（Action）状态特性方法
    public:
        /// \brief 定义提示信息
        /// \param enStatus  绘制矩形的操作状态
        /// \param promptMsg [out] 提示字符串
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefinePromptMsg(std::wstring& promptMsg, const gcmp::DrawRectStatus status) = 0;

        /// \brief 定义光标类型
        /// \param enStatus  绘制矩形的操作状
        /// \param cursorType [out] 光标类型
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefineCursorType(gcmp::CursorType& cursorType, const gcmp::DrawRectStatus status) = 0;

        /// \brief 初始化Action
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnInitAction(IUiView* pCurrentView) = 0;

        /// \brief 响应Action拾取第一点状态改变
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnEnterGettingFirstPointState(IUiView* pCurrentView) = 0;

        /// \brief 响应Action拾取对角点状态改变
        /// \param pCurrentView 当前Action运行所属的视图
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnEnterGettingCornerPointState(IUiView* pCurrentView) = 0;

        /// \brief 绘制矩形操作完成行为定制
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param firstPoint 第一点的模型空间坐标
        /// \param cornerPoint 对角点的模型空间坐标
        /// \param firstSnap 第一点的捕捉信息
        /// \param cornerSnap 对角点的捕捉信息
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnDrawRectFinished(IUiView* pCurrentView, const gcmp::Vector3d& firstPoint, const gcmp::Vector3d& cornerPoint, const gcmp::ISnap* firstSnap, const gcmp::ISnap* cornerSnap) = 0;

        /// \brief 响应Action释放
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnDestroyAction() = 0;


        /// \brief 预览显示特性方法
    public:
        /// \brief 矩形预显过程，更新预览表达数据
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param firstPoint 第一点的模型空间坐标
        /// \param mousePoint 本次拾取操作后，拾取点的模型空间坐标
        /// \param opGElementShape [in, out]用来预览的表达数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetGElementShapeOnPointUpdate(IUiView* pCurrentView, const gcmp::Vector3d& firstPoint, const gcmp::Vector3d& mousePoint, OwnerPtr<IGraphicsElementShape>& opGElementShape) = 0;
    };
}
